package entity;

import java.util.Calendar;

public class Position {
	private float latitude, longitude;
	private Calendar time;
	/**
	 * @uml.property  name="taxa"
	 * @uml.associationEnd  inverse="position:entity.Taxa"
	 */
	private Taxi taxa;

	public Position(Calendar time, float latitude, float longitude)
	{

		this.time=time;
		this.longitude=longitude;
		this.latitude=latitude;

	}

	/**
	 * Getter of the property <tt>taxa</tt>
	 * @return  Returns the taxa.
	 * @uml.property  name="taxa"
	 */
	public Taxi getTaxa() {
		return taxa;
	}

	/**
	 * Setter of the property <tt>taxa</tt>
	 * @param taxa  The taxa to set.
	 * @uml.property  name="taxa"
	 */
	public void setTaxa(Taxi taxa) {
		this.taxa = taxa;
	}


	/**Metoden sætter en ny position på objektet
	 */
	public void setNewPosition(float latitude, float longitude, Calendar time){
		this.latitude = latitude;
		this.longitude = longitude;
		this.time = time;
	}

	public boolean positionChanged(float longitude, float latitude){
		boolean changed=false;
		
		if(this.latitude == latitude && this.longitude == longitude){
			changed=false;
		} else changed=true;
		
		return changed;
	}
	
	/**
	 * @return the altitude
	 */
	public float getLatitude() {
		return latitude;
	}

	/**
	 * @return the longitude
	 */
	public float getLongitude() {
		return longitude;
	}

	/**
	 * @return the time
	 */
	public Calendar getTime() {
		return time;
	}

}
